<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/share/_meta.jsp" %>
<%@ include file="/share/_footer.jsp" %>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/h-ui/common/jquery.editable-select.min.css" />
<div class="page-container">
    <form class="form form-horizontal" id="myform" action="" method="post">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目类型：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="layui-input input-text radius size-L" value="" placeholder="项目类型" name="projectid" id="projectid">
                <%--<select class="form-control shift-info" name="projectid" required>
                    <option value='' disabled selected style='display:none;'>请选择类型</option>
                    <option value='1'>广告</option>
                    <option value='2'>摆摊</option>
                    <option value='3'>卖纸皮</option>
                    <option value='4'>维修费</option>
                </select>--%>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>费用类型：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select class="form-control shift-info" name="costtypeid">
                    <option value='1' disabled selected style='display:none;'>物业服务费</option>
                </select>
                <%--<select class="form-control shift-info" name="costtypeid" required>
                    <option value='' disabled selected style='display:none;'>请选择费用类型</option>
                    <c:forEach items="${costList}" var="item">
                        <option value="${item.id}" <c:if test="${billaccount.costType==item.id }">selected</c:if>>${item.name}</option>
                    </c:forEach>
                </select>--%>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>支付方式：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select class="form-control shift-info" name="payType" required>
                    <option value='' style='display:none;'>请选择方式</option>
                    <option value='1'>现金</option>
                    <option value='2'>支付宝</option>
                    <option value='3'>微信</option>
                    <option value='4'>POS机</option>
                    <option value='5'>银行转帐</option>
                    <option value='6'>抵用券</option>
                    <option value='99'>其他</option>
                </select>
            </div>
        </div>
        <%--<div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>账期：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="layui-input input-text radius size-L" value="" placeholder="yyyy年MM" name="acctPeriod" required>
            </div>
        </div>--%>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>付款单位：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="layui-input input-text radius size-L" value="" placeholder="付款单位" name="feeUnit" id="feeUnit">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>电话：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="layui-input input-text radius size-L" value="" placeholder="电话" name="phone" id="phone">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>金额：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="layui-input input-text radius size-L" value="" placeholder="金额" name="fee" id="fee">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button type="submit" class="btn btn-secondary radius size-L">保&nbsp;存</button>
                <button type="button" class="btn btn-secondary radius size-L" onclick="layer_close();">取&nbsp;消</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/h-ui/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/h-ui/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/h-ui/common/laydate.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/h-ui/common/jquery.editable-select.min.js"></script>
<script type="text/javascript">
    $(function(){
    });

    $("#myform").validate({
        rules:{
            projectid : {
                required: true
            },
            phone : {
                required: true
            },
            fee : {
                required: true,
                number : true
            },
            feeUnit : {
                required: true
            }
        },
        submitHandler:function(form) {
            $(form).ajaxSubmit({
                type: 'post',
                url: "${pageContext.request.contextPath }/rest/directfee/saveDirectFee",
                success: function(data){
                    if (data.success) {
                        window.parent.location.reload();
                    }else {
                        layer.alert(data.message);
                    }
                },
                error: function(XmlHttpRequest, textStatus, errorThrown){
                    layer.closeAll('loading');
                    layer.alert('error!',{icon:1,time:1000});
                }
            });
        }
    });
</script>